1、数据表格中有以下两种方式 ,根据状态判断和自定义函数模板函数
table.render({
elem: '#list'
, url: '/money/queryAllByPage'
, parseData: function (res) { //res 即为原始返回的数据
return {
"code": res.status, //解析接口状态
"msg": res.msg, //解析提示文本
"count": res.obj.total,
"data": res.obj.list //解析数据列表
};
}
, toolbar: '#barTable' //开启头部工具栏,并为其绑定左侧模板
, defaultToolbar: ['filter', 'exports', 'print']
, title: '用户数据表'
, cols: [
[
{field: 'id', title: 'ID', fixed: 'left', sort: true,width:80}
, {field: 'accout', title: '下单账户'}
, {field: 'moneyNum', title: '兑换金额'}
, {field: 'pointNum', title: '积分数量'}
, {field: 'createDt',sort: true, title: '下单时间',templet : "#NOTICE_DATE_TIME"}
, {field: 'status', title: '状态',templet: function(d){
if(d.status==0){
return '待通过'
}else if(d.status==2){
return '已驳回'
}else if(d.status==1){
return '已通过'
}else if(d.status==3){
return '已撤销'
}
}}
, {fixed: 'right', title: '操作', toolbar: '#barRow',width:220}
]
]
, page: true
});
{
{# if(d.createDt !=null){ }}
{
{layui.util.toDateString(d.createDt, 'yyyy/MM/dd HH:mm:ss')}}
{
{# } else {}}
{
{}}
{
{# } }}
2、据行数据属性显示不同的行工具
{
{# if(d.status== 0){ }}
通过
驳回
{
{# } }}
{
{# if(d.status== 1){ }}
驳回
删除
{
{# } }}
|